package com.bkgy.modular.tbdsjc621sameedgeresult.controller;

import com.alibaba.fastjson.JSONObject;
import com.bkgy.modular.tbdsjc621sameedgeresult.service.TbDsjC621SameEdgeResultService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/TbDsjC621SameEdgeResult")
public class TbDsjC621SameEdgeResultController {
    @Resource
    private TbDsjC621SameEdgeResultService tbDsjC621SameEdgeResultService;

    @PostMapping("/findByPage")
    public ResultData findData(@RequestBody String data){
        return tbDsjC621SameEdgeResultService.findDataTbDsjC621SameEdgeResultServiceByPage(data);
    }

    @CrossOrigin
    @RequestMapping(value = {"/findSameEdgeByVolumeNo621"}, method = RequestMethod.POST)
    @ResponseBody
    public ResultData findSameEdgeByVolumeNo621(@RequestBody String data) {
        JSONObject jsonObject = JSONObject.parseObject(data);
        String data1 = jsonObject.getString("data");
        List<String> list = JSONObject.parseArray(data1, String.class);
        return tbDsjC621SameEdgeResultService.findSameEdgeByVolumeNo621(list);
    }


    /**
     * 列表导出功能
     * @param jsonObject
     * @param response
     */
    @PostMapping("/exportXlsx")
    public void export(@RequestBody JSONObject jsonObject, HttpServletResponse response) {
        tbDsjC621SameEdgeResultService.export(jsonObject,response);
    }

    /**
     * 新增冷轧边降二维图
     * @param jsonObject
     * @return
     */
    @PostMapping("/finByCurce")
    public ResultData findByCurce(@RequestBody JSONObject jsonObject) {
        return tbDsjC621SameEdgeResultService.findByCurce(jsonObject);
    }
}
